package com.zs.studentmanager.exception;

import com.zs.studentmanager.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author: 周小白
 * @date: 2023-11-25 13:40
 * @description: 全局异常处理
 **/
@ControllerAdvice
public class GlobalException {

    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Result handlerException(Exception e) {
        return Result.fail(e.getMessage());
    }
}
